package llama.ctrl;

import java.util.Date;

import llama.core.ChatModelLocator;
import llama.core.IMessage;
import llama.core.IUser;
import llama.core.Message;
import llama.network.NetworkMessage;

public class SendMessageCtrl implements IController{
	private IMessage message;
	
	@Override
	public void execute() {
		ChatModelLocator.getChatModel().send(new NetworkMessage(message, NetworkMessage.Type.MESSAGE));
	}
	
	public void setMessage(final String message, final IUser toUser) {
		IUser activeUser = ChatModelLocator.getChatModel().getActiveUser();
		Date time = new Date(System.currentTimeMillis());
		this.message = new Message(message, activeUser, toUser, time);
	}
}
